<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">

<head>
    <!-- 页面meta -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>商品编辑</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">
  
    <link rel="stylesheet" href="/plugins/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="/plugins/adminLTE/css/AdminLTE.css">
    <link rel="stylesheet" href="/plugins/adminLTE/css/skins/_all-skins.min.css">
    <link rel="stylesheet" href="/css/style.css">
	<script src="/plugins/jQuery/jquery-2.2.3.min.js"></script>
    <script src="/plugins/bootstrap/js/bootstrap.min.js"></script>
	<script type="text/javascript" src="/js/bootstrap-fileinput/js/fileinput.js"></script>
	<script type="text/javascript" src="/js/bootstrap-fileinput/js/locales/zh.js"></script>
	<link rel="stylesheet" type="text/css" href="/js/bootstrap-fileinput/css/fileinput.css">
    
    <!-- 富文本编辑器 -->
	<link rel="stylesheet" href="../plugins/kindeditor/themes/default/default.css" />
	<script charset="utf-8" src="../plugins/kindeditor/kindeditor-min.js"></script>
	<script charset="utf-8" src="../plugins/kindeditor/lang/zh_CN.js"></script>
    
    
     <script>
		 $(function () {
			$("#file").fileinput({
				language : "zh",
				uploadUrl : "/file/upload",
				maxFileSize : 2048,
				maxFileCount: 3,
				allowedFileExtensions: ["jpg", "png", "gif"],
				enctype : "multipart/form-data"
			})
			 $("#file").on("fileuploaded", function (event, data, previewId, index) {
				 $("#itemImages").val(data.response.data)
			 })
		 })

		 function setSelect(obj) {
			 var id = obj.value
			 $.get("/itemCatController/getItemInfo?parentId=" + id, function (rs) {
				 var arr = rs.data
				 var op = ""
				 op += '<option>请选择</option>'
				 for (var i = 0; i < arr.length; i++) {
					 op += '<option value = "' + arr[i].id + '">' + arr[i].name + '</option>'
				 }
				 $("#s2").html(op)
			 })
		 }

		 function setSelectAgain(obj) {
			 var id = obj.value
			 $.get("/itemCatController/getItemInfo?parentId=" + id, function (rs) {
				 var arr = rs.data
				 var op = ""
				 op += '<option>请选择</option>'
				 for (var i = 0; i < arr.length; i++) {
					 op += '<option value = "' + arr[i].id + '">' + arr[i].name + '</option>'
				 }
				 $("#s3").html(op)
			 })
		 }

		 function getTypeId(obj) {
			 var id = obj.value
			 $.get("/itemCatController/getTypeId?id=" + id, function (rs) {
				 $("#span_id").html(rs.data)
				 var typeId = rs.data
				 $.get("/typeController/getOneType?typeId=" + typeId, function (rs) {
					 var arr = JSON.parse(rs.data.brandIds)
					 var ps = ""
					 ps += '<option>请选择</option>'
					 for (var i = 0; i < arr.length; i++) {
						 ps += '<option value = "' + arr[i].id + '">' + arr[i].text + '</option>'
					 }
					 $("#goods_brand_id").html(ps)
					 var cusarr = JSON.parse(rs.data.customAttributeItems)
					 var tr = ""
					 for (var i = 0; i < cusarr.length; i++) {
						 tr += "<tr>"
						 tr += '<td class="col-md-2 title">' + cusarr[i].text + '</td>'
						 tr += '<td class="col-md-10 data">'
						 tr += '<input class="form-control" placeholder="扩展属性' + (i + 1) + '">'
						 tr += '</td>'
						 tr += '</tr>'
					 }
					 $("#cus_id").html(tr)
				 })
			 })
		 }

		 function setTr() {
			 var ta = document.getElementById("tb_id")
			 var tr = document.createElement("tr")
			 tr.innerHTML = '<td>' + $("#color_id").val() + '</td><td><img src = "' + $("#itemImages").val() + '" width = "100px" height = "100px"/></td>'
					 + '<td><button type="button" class="btn btn-default" title="删除" onclick="deleteRow(this)" ><i class="fa fa-trash-o"></i>删除</button></td>'
			 ta.appendChild(tr)
		 }

		 function deleteRow(obj) {
			 var ta = document.getElementById("tb_id")
			 var td = obj.parentNode
			 var tr = td.parentNode
			 ta.removeChild(tr)
		 }

		 function saveGoods() {
			 var trs = $("#tb_id").find("tr")
			 var imgs = []
			 for (var i = 0; i < trs.length; i++) {
				 var tds = $(trs[i]).find("td")
				 var color = $(tds[0]).text()
				 var img = $(tds[1]).find("img")
				 var url = $(img).attr("src")
				 var str = {color : color, url : url}
				 imgs.push(str)
			 }

			 var itemImages = JSON.stringify(imgs)
			 var cus = $("#cus_id").find("tr")
			 var customAttributeItem = []
			 for (var i = 0; i < cus.length; i++) {
				 var tds = $(cus[i]).find("td")
				 var text = $(tds[0]).text()
				 var input = $(tds[1]).find("input")
				 var value = $(input).val()
				 var str = {text : text, value : value}
				 customAttributeItem.push(str)
			 }
			 var customAttributeItems = JSON.stringify(customAttributeItem)
			 var addArr = []
			 var s1 = ""
			 var s2 = ""
			 var pros = $("#addProperty_id").find("tr")
			 for(var i = 1; i < pros.length; i++) {
				 var tds = $(pros[i]).find("td")
				 if (tds.length == 6) {
					 var v1 = $(tds[0]).text()
					 var v2 = $(tds[1]).text()
					 var p = $(tds[2]).find("input")
					 var price = $(p).val()
					 var stt = $("#goodsName").val() + v1 + v2
					 var so = $(tds[3]).find("input")
					 var socketCount = $(so).val()
					 var ic = $(tds[4]).find("input")
					 var icv = $(ic).val()
					 var ths = $(pros[0]).find("th")
					 var thp1 = $(ths[0]).text()
					 var thp2 = $(ths[1]).text()
					 s1 = thp1
					 s2 = thp2
					 var spec = "{" + "\""+thp1 + "\"" +  ":" + "\"" +v1 + "\"" + "," +"\""+thp2 +"\""+ ":"+"\"" +v2+ "\"" +"}";
					 var st = {title : stt, price : price, stockCount : socketCount, categoryid : $("#s3").val(), status : 1, createTime : new Date().getTime(), isDefault : 1, category : $("#s3").find("option:selected").text(), brand : $("#goods_brand_id").find("option:selected").text(), spec : spec, num : 10, updateTime : new Date().getTime(), image : $("#itemImages").val()}
					 addArr.push(st)
				 }else {
					 var v1 = $(tds[0]).text()
					 var p = $(tds[1]).find("input")
					 var price = $(p).val()
					 var so = $(tds[2]).find("input")
					 var socketCount = $(so).val()
					 var ic = $(tds[3]).find("input")
					 var icv = $(ic).val()
					 var ths = $(pros[0]).find("th")
					 var thp1 = $(ths[0]).text()
					 s1 = thp1
					 var spec = {thp1 : v1}
					 var st = {title : $("#goodsName").val() + v1, price : price, stockCount : socketCount, categoryid : $("#s3").val(), status : 1, createTime : new Date().getTime(), isDefault : 1, category : $("#s3").find("option:selected").text(), brand : $("#goods_brand_id").find("option:selected").text(), spec : spec, num : 10, updateTime : new Date().getTime(), image : $("#itemImages").val()}
					 addArr.push(st)
				 }
			 }
			 var propertys = JSON.stringify(addArr)
			 var specificationItems = JSON.stringify(items)
			 $.ajax({
				 url : "/goodsController/saveGoods",
				 type : "get",
				 dataType : "json",
				 data : {
					 category1Id : $("#s1").val(),
					 category2Id : $("#s2").val(),
					 category3Id : $("#s3").val(),
					 goodsName : $("#goodsName").val(),
					 caption : $("#caption").val(),
					 price : $("#price").val(),
					 introduction : editor.html(),
					 packageList : $("#packageList").val(),
					 saleService : $("#saleService").val(),
					 typeTemplateId : $("#span_id").text(),
					 brandId : $("#goods_brand_id").val(),
					 itemImages : itemImages,
					 customAttributeItems : customAttributeItems,
					 propertys : propertys,
					 specificationItems : specificationItems,
					 thp1 : s1,
					 thp2 : s2
				 },
				 traditional : true,
				 success : function (rs) {
					 alert(rs.message)
					 location.reload()
				 }
			 })
		 }

		 function enableItem() {
			 var typeId = $("#span_id").text()
			 if ($("[name=check]").prop("checked")) {
				 $.get("/typeController/getSpecInfo?typeId=" + typeId, function (rs) {
				 	console.log(rs);
					 var vos = rs.data
					 var div = ""
					 for (var i = 0; i < vos.length; i++) {
						 div += '<div name="specificationName" >'
						 div += '<div class="col-md-2 title">' + vos[i].tbSpecification.specName + '</div>'
						 div += '<div class="col-md-10 data">'
						 for (var a = 0; a < vos[i].optionList.length; a++) {
							 div += '<span><input type = "checkbox" onclick = "checkSpec(this)" value="' + vos[i].optionList[a].id + '">' + vos[i].optionList[a].optionName + '</span>'
						 }
						 div += '</div>'
						 div += '</div>'
					 }
					 $("#enableSpec_id").html(div)
				 })
			 }else {
				 $("#enableSpec_id").html("")
				 $("#addProperty_id").html("")
			 }
		 }

		 var items = [];
		 //勾选规格选项复选框函数
		 function checkSpec(event){
			 var span = event.parentNode
			 var value = $(span).text()
			 var div1 = span.parentNode
			 var div2 = div1.previousSibling
			 var name = $(div2).text()
			 //调用方法判断原集合中是否已有attributeName
			 var obj = searchObjectByKey(items,'attributeName',name);
			 if(obj != null){
				 if($(event).prop('checked')){//勾选
					 //如果之前有数据，往原有的对象中追加
					 obj.attributeValue.push(value);
				 }else{//取消勾选
					 obj.attributeValue.splice(obj.attributeValue.indexOf(value),1)//从items中移除规格选项
					 //如果规格选项没有数据了
					 if(obj.attributeValue.length==0){
						 //移除items中的数据
						 items.splice(items.indexOf(obj),1)
					 }
				 }
			 }else{
				 //如果之前没有数据，items新加数据
				 items.push({'attributeName':name,'attributeValue':[value]});
			 }
			 //console.log(items);
			 //后续调用，这里先不调用，后续选择之后组装选择后的数据用的
			 var tem = createItemList();

			 createTable(tem)

		 }

		 //遍历组装用户勾选规格选项数据
		 function searchObjectByKey(list,attributeName,attributeValue){
			 for(var i=0;i<list.length;i++){
				 //如果list中我们选择key存在
				 if(list[i][attributeName] == attributeValue){
					 return list[i];//返回当前对象
				 }
			 }
			 //遍历结束后都不存在，返回null
			 return null;
		 }

		 //创建SKU列表
		 function createItemList(){
			 //创建初始值
			 var itemList = [{att:{}}] ;
			 for(var i = 0; i < items.length; i++){
				 itemList =  addColum(itemList,items[i].attributeName,items[i].attributeValue);
			 }

			 return itemList;
		 }

		 //添加表格的列
		 function addColum(list,columName,columValues) {
			 //定义新集合接收行
			 var newList = [];
			 for(var i = 0; i < list.length; i++){
				 var oldRow = list[i];
				 for(var j=0; j < columValues.length; j++){
					 var newRow = JSON.parse(JSON.stringify(oldRow)); //深克隆
					 newRow.att[columName] = columValues[j];
					 newList.push(newRow)
				 }
			 }
			 return newList;
		 }

		 function createTable(obj) {
			 var a = JSON.stringify(obj)
			 var arr = JSON.parse(a)
			 var b = JSON.stringify(arr[0].att)
			 var d = b.substring(1, (b.length - 1))
			 var e = d.split(":")
			 var tr = ""
			 tr += '<tr>'
			 for (var i = 0; i < e.length; i++) {
				 if (i == 1) {
					 var ee = e[i].split(",")
					 for (var j = 1; j < ee.length; j++) {
						 tr += '<th class="sorting" id = "p">' + JSON.parse(ee[j]) + '</th>'
					 }
				 }
				 if (i == 0) {
					 tr += '<th class="sorting" id = "p">' + JSON.parse(e[i]) + '</th>'
				 }
			 }
			 tr += '<th class="sorting">价格</th>'
			 tr += '<th class="sorting">库存</th>'
			 tr += '<th class="sorting">是否启用</th>'
			 tr += '<th class="sorting">是否默认</th>'
			 tr += '</tr>'
			 for (var i = 0; i < arr.length; i++) {
				 tr += '<tr>'
				 var js = JSON.stringify(arr[i].att)
				 var a = js.indexOf(":")
				 if (js.search(",") != -1) {
					 var dh = js.indexOf(",")
					 tr += '<td>' + js.substring(a + 2, dh - 1) + '</td>'
					 var b = js.lastIndexOf(":")
					 tr += '<td>' + js.substring(b + 2, js.length - 2) + '</td>'
				 }else {
					 tr += '<td>' + js.substring(a + 2, js.length - 2) + '</td>'
				 }
				 tr += '<td><input class="form-control"  placeholder="价格"></td>'
				 tr += '<td><input class="form-control" placeholder="库存数量"></td>'
				 tr += '<td><input type="checkbox" ></td>'
				 tr += '<td><input type="checkbox" ></td>'
				 tr += '</tr>'
			 }
			 $("#addProperty_id").html(tr)
		 }

	 </script>

	<!--<tr>
		<td>
			4.0
		</td>
		<td>
			4G
		</td>
		<td>
			<input class="form-control"  placeholder="价格">
		</td>
		<td>
			<input class="form-control" placeholder="库存数量">
		</td>
		<td>
			<input type="checkbox" >
		</td>
		<td>
			<input type="checkbox" >
		</td>
	</tr>-->

            <!-- 正文区域 -->
            <section class="content">

                <div class="box-body">

                    <!--tab页-->
                    <div class="nav-tabs-custom">

                        <!--tab头-->
                        <ul class="nav nav-tabs">                       		
                            <li class="active">
                                <a href="#home" data-toggle="tab">商品基本信息</a>                                                        
                            </li>   
                            <li >
                                <a href="#pic_upload" data-toggle="tab">商品图片</a>                                                        
                            </li>    
                            <li >
                                <a href="#customAttribute" data-toggle="tab">扩展属性</a>                                                        
                            </li>     
                            <li >
                                <a href="#spec" data-toggle="tab" >规格</a>                                                        
                            </li>                       
                        </ul>
                        <!--tab头/-->
						
                        <!--tab内容-->
                        <div class="tab-content">

                            <!--表单内容-->
                            <div class="tab-pane active" id="home">
                                <div class="row data-type">                                  
								   <div class="col-md-2 title">商品分类</div>
		                          
		                           	  <div class="col-md-10 data">
		                           	  	<table>
		                           	  		<tr>
		                           	  			<td>
		                           	  				<select class="form-control" id = "s1" name = "" onchange = "setSelect(this)">
														<option value = "-1">请选择</option>
														<option th:each="it : ${it}" th:value="${it.id}">[[${it.name}]]</option>
		                           	  				</select>
		                              			</td>
		                              			<td>
		                           	  				<select class="form-control select-sm" id = "s2" onchange = "setSelectAgain(this)"></select>
		                              			</td>
		                              			<td>
		                           	  				<select class="form-control select-sm" id = "s3" onchange = "getTypeId(this)"></select>
		                              			</td>
		                              			<td>
													模板ID:<span id = "span_id"></span>
		                              			</td>
		                           	  		</tr>
		                           	  	</table>
		                              	
		                              </div>	                              
		                          	  
									
		                           <div class="col-md-2 title">商品名称</div>
		                           <div class="col-md-10 data">
		                               <input type="text" class="form-control"    placeholder="商品名称" id = "goodsName">
		                           </div>
		                           
		                           <div class="col-md-2 title">品牌</div>
		                           <div class="col-md-10 data">
		                              <select class="form-control" id = "goods_brand_id"></select>
		                           </div>
		
								   <div class="col-md-2 title">副标题</div>
		                           <div class="col-md-10 data">
		                               <input type="text" class="form-control"   placeholder="副标题" id = "caption">
		                           </div>
		                           
		                           <div class="col-md-2 title">价格</div>
		                           <div class="col-md-10 data">
		                           	   <div class="input-group">
			                          	   <span class="input-group-addon">¥</span>
			                               <input type="text" class="form-control"  placeholder="价格" id = "price">
		                           	   </div>
		                           </div>
		                           
		                           <div class="col-md-2 title editer">商品介绍</div>
                                   <div class="col-md-10 data editer">
                                       <textarea name="content" id = "introduction" style="width:800px;height:400px;visibility:hidden;" ></textarea>
                                   </div>
		                           
		                           <div class="col-md-2 title rowHeight2x">包装列表</div>
		                           <div class="col-md-10 data rowHeight2x">
		                               
		                           	<textarea rows="4" id = "packageList"  class="form-control"   placeholder="包装列表"></textarea>
		                           </div>
		                           
		                           <div class="col-md-2 title rowHeight2x">售后服务</div>
		                           <div class="col-md-10 data rowHeight2x">
		                               <textarea rows="4" id = "saleService"  class="form-control"    placeholder="售后服务"></textarea>
		                           </div>                        
                                  
                                    
                                </div>
                            </div>
                            
                            <!--图片上传-->
                            <div class="tab-pane" id="pic_upload">
                                <div class="row data-type">                                  
								 <!-- 颜色图片 -->
								 <div class="btn-group">
					                 <button type="button" class="btn btn-default" title="新建" data-target="#uploadModal"  data-toggle="modal"  ><i class="fa fa-file-o"></i> 新建</button>
                             		                 
					             </div>
								 
								 <table class="table table-bordered table-striped table-hover dataTable" id = "ta_img">
					                    <thead>
					                        <tr>
											    <th class="sorting">颜色</th>
											    <th class="sorting">图片</th>
												<th class="sorting">操作</th>
							            </thead>
					                    <tbody id = "tb_id">
					                      <!--<tr>
									            <td>
									            	
									            </td>
									            <td>
									           		<img alt="" src="" width="100px" height="100px">	            	 
									            </td>
												 <td>
													 <button type="button" class="btn btn-default" title="删除" ><i class="fa fa-trash-o"></i> 删除</button>
												 </td>
					                      </tr>-->
					                    </tbody>
								 </table> 
								  
                                </div>
                            </div>

                            <!--扩展属性-->
                            <div class="tab-pane" id="customAttribute">
                                <table class="row data-type" id = "cus_id">
	                                <!--<tr>
		                                <td class="col-md-2 title">扩展属性1</td>
				                        <td class="col-md-10 data">
				                              <input class="form-control" placeholder="扩展属性1">	            	 
				                        </td>
	                                </tr>
									<tr>
		                                <td class="col-md-2 title">扩展属性2</td>
				                        <td class="col-md-10 data">
				                              <input class="form-control" placeholder="扩展属性2">	            	 
				                        </td>-->
	                                </tr>
                                </table>
                            </div>

                            <!--规格-->
                            <div class="tab-pane" id="spec">
                            	<div class="row data-type">
	                            	<div class="col-md-2 title">是否启用规格</div>
			                        <div class="col-md-10 data">
			                        	<input type="checkbox" name = "check" onclick = "enableItem()">
			                        </div>
                            	</div>
                            	<p>
                            	
                            	<div>
                            	
	                                <div class="row data-type" id = "enableSpec_id">
	                                
		                                <!--<div name="specificationName" >
			                                &lt;!&ndash;<div class="col-md-2 title">屏幕尺寸</div>
					                        <div class="col-md-10 data">
					                               
					                            <span>
					                            	<input  type="checkbox" >4.0					                            				                            	
					                            </span>  	
												<span>
					                            	<input  type="checkbox" >4.5					                            				                            	
					                            </span>
												<span>
					                            	<input  type="checkbox" >5.0					                            				                            	
					                            </span>												
					                            	
					                        </div>&ndash;&gt;
		                                </div>-->
										<!--<div name="specificationName">
			                                <div class="col-md-2 title">网络制式</div>
					                        <div class="col-md-10 data">
					                               
					                            <span>
					                            	<input  type="checkbox" >2G					                            				                            	
					                            </span>  	
												<span>
					                            	<input  type="checkbox" >3G					                            				                            	
					                            </span>
												<span>
					                            	<input  type="checkbox" >4G					                            				                            	
					                            </span>												
					                            	
					                        </div>
		                                </div>-->
		                                                                                  
	                                </div>
	
	                                
	                                <div class="row data-type">
	                                	 <table class="table table-bordered table-striped table-hover dataTable" id = "addProperty_id">
						                    <!--<thead>
						                        <tr>
												    <th class="sorting" id = "p">屏幕尺寸</th>
													<th class="sorting" id = "pp">网络制式</th>
												    <th class="sorting">价格</th>
												    <th class="sorting">库存</th>
												    <th class="sorting">是否启用</th>
												    <th class="sorting">是否默认</th>
											    </tr>
								            </thead>
						                    <tbody>
						                     	<tr>
										            <td>
										            	4.0
										            </td>
													<td>
										            	3G
										            </td>
										            <td>
										           		<input class="form-control"  placeholder="价格">
										            </td>
										            <td>
										            	<input class="form-control" placeholder="库存数量">
										            </td>
										            <td>
										             	<input type="checkbox" >
										            </td>
										            <td>
										                <input type="checkbox" >
										            </td>
						                      </tr>
											  <tr>
										            <td>
										            	4.0
										            </td>
													<td>
										            	4G
										            </td>
										            <td>
										           		<input class="form-control"  placeholder="价格">
										            </td>
										            <td>
										            	<input class="form-control" placeholder="库存数量">
										            </td>
										            <td>
										             	<input type="checkbox" >
										            </td>
										            <td>
										                <input type="checkbox" >
										            </td>
						                      </tr>
											  <tr>
													<td>
										            	5.0
										            </td>
													<td>
										            	3G
										            </td>
										            <td>
										           		<input class="form-control"  placeholder="价格">
										            </td>
										            <td>
										            	<input class="form-control" placeholder="库存数量">
										            </td>
										            <td>
										             	<input type="checkbox" >
										            </td>
										            <td>
										                <input type="checkbox" >
										            </td>
						                      </tr>
											  <tr>
													<td>
										            	5.0
										            </td>
													<td>
										            	4G
										            </td>
										            <td>
										           		<input class="form-control"  placeholder="价格">
										            </td>
										            <td>
										            	<input class="form-control" placeholder="库存数量">
										            </td>
										            <td>
										             	<input type="checkbox" >
										            </td>
										            <td>
										                <input type="checkbox" >
										            </td>
						                      </tr>

						                    </tbody>-->
									 	</table>
								
	                                </div>
	                                
	                            </div>
                            </div>
                            
                        </div>
                        <!--tab内容/-->
						<!--表单内容/-->
							 
                    </div>
                 	
                 	
                 	
                 	
                   </div>
                  <div class="btn-toolbar list-toolbar">
				      <button class="btn btn-primary" onclick = "saveGoods()" ><i class="fa fa-save"></i>保存</button>
				      <button class="btn btn-default" >返回列表</button>
				  </div>
			
            </section>
            


<!-- 上传窗口 -->
<div class="modal fade" id="uploadModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog" >
	<div class="modal-content">
		<div class="modal-header">
			<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
			<h3 id="myModalLabel">上传商品图片</h3>
		</div>
		<div class="modal-body">							
			
			<table class="table table-bordered table-striped">
		      	<tr>
		      		<td>颜色</td>
		      		<td><input  class="form-control" placeholder="颜色" id = "color_id" >  </td>
		      	</tr>			    
		      	<tr>
		      		<td>商品图片</td>
		      		<td>
						<table>
							<tr>
								<td>
									<input type="file" name="itemImages" id = "file" />
									<input type = "text" name = "itemImages" id = "itemImages">
					            </td>
							</tr>						
						</table>
		      		</td>
		      	</tr>		      	
			 </table>				
			
		</div>
		<div class="modal-footer">						
			<button class="btn btn-success"  data-dismiss="modal" aria-hidden="true" onclick = "setTr()">保存</button>
			<button class="btn btn-default" data-dismiss="modal" aria-hidden="true">关闭</button>
		</div>
	  </div>
	</div>
</div>

            
            <!-- 正文区域 /-->
<script type="text/javascript">

	var editor;
	KindEditor.ready(function(K) {
		editor = K.create('textarea[name="content"]', {
			allowFileManager : true
		});
	});

</script>
       
</body>

</html>
